import request from '@/utils/request'

/**
 * 用户登录
 * @param {Object} credentials - 登录凭证
 * @param {string} credentials.username - 用户名
 * @param {string} credentials.password - 密码
 * @returns {Promise} 登录结果
 */
export const login = async (credentials) => {
  try {
    const response = await request.post('/api/auth/login', credentials)
    console.log('登录API返回:', response)
    return response
  } catch (error) {
    console.error('登录API错误:', error)
    throw error
  }
}

export default {
  login,
}
